//
//  GWPushGuideView.m
//  百思不得姐
//
//  Created by qianfeng on 16/3/3.
//  Copyright © 2016年 高炜. All rights reserved.
//

#import "GWPushGuideView.h"

@implementation GWPushGuideView
- (IBAction)close {
    [self removeFromSuperview];
}

+(GWPushGuideView *)guideView
{
    return [[[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self) owner:nil options:nil]lastObject];
}

+(void)show
{
    NSString *key =@"CFBundleShortVersionString";
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];
    NSString *oldVersion =[[NSUserDefaults standardUserDefaults]stringForKey:key];
    if (![currentVersion isEqualToString:oldVersion]) {
        UIWindow *window =[UIApplication sharedApplication].keyWindow;
        GWPushGuideView *guideView =[GWPushGuideView guideView];
        guideView.frame =window.bounds;
        [window addSubview:guideView];
        
        [[NSUserDefaults standardUserDefaults]setObject:currentVersion forKey:key];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
    
}
@end
